Public Class TempFileManagerForm

  Private _fileManager As New dotNetTips.Utility.IO.TempFileManager


  Private Sub CreateFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateFileButton.Click

    Me._fileManager.CreateFile()

    Me.LoadFiles()

  End Sub

  Private Sub LoadFiles()


    Me.FilesListBox.Items.Clear()


    For Each file As String In Me._fileManager.FilesList
      Me.FilesListBox.Items.Add(file)
    Next


  End Sub

  Private Sub DeleteFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteFileButton.Click
    If Me.FilesListBox.Items.Count > 0 Then
      Me._fileManager.DeleteFile(Me.FilesListBox.Items.Item(0).ToString)
    End If

    Me.LoadFiles()

  End Sub

  Private Sub DeleteAllFilesButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteAllFilesButton.Click
    Me._fileManager.DeleteAllFiles()
    Me.LoadFiles()
  End Sub

  Private Sub DisposeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisposeButton.Click
    Me._fileManager.Dispose()
    Me.LoadFiles()
  End Sub
End Class